﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Medianamik.Core.Security;
using System.Collections.Generic;

namespace Medianamik.UI.Web
{
    public partial class MasterPanel : Medianamik.UI.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ListViewBlocks.DataBind();
            }
        }

        void ListViewBlocks_DataBinding(object sender, EventArgs e)
        {
            
        }

        protected IEnumerable<SiteMapNode> GetFirstLevel()
        {
            var nodes = from node in SiteMap.RootNode.ChildNodes.Cast<SiteMapNode>()
                        let childNodes = node.ChildNodes.Cast<SiteMapNode>().Where(n => bool.Parse(n["displayInMenu"]))
                        where childNodes.Any()
                        select node;
            return nodes;

        }
        protected IEnumerable<SiteMapNode> GetSecondLevel(SiteMapNode pParentNode)
        {
            return pParentNode.ChildNodes.Cast<SiteMapNode>().Where(n => bool.Parse(n["displayInMenu"]));
        }
       

    }
}
